package com.sk.bilibili.utils;

import android.content.SharedPreferences;

public class PreferenceUtils {

    private SharedPreferences preferences;

    public PreferenceUtils(SharedPreferences preferences) {
        this.preferences=preferences;
    }

    public String getString(String key) {
        return preferences.getString(key,null);
    }

    public void setString(String key, String value) {
        preferences.edit().putString(key,value).apply();
    }

    public int getInt(String key, int defValue) {
        return preferences.getInt(key,defValue);
    }

    public void setInt(String key,int value){
        preferences.edit().putInt(key,value).apply();
    }

    public void remove(String key) {
        preferences.edit().remove(key).apply();
    }

}